home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: twisto.eng.hou.compaq.com!news
- From: Saurabh Dixit <saurabhd@bangate.compaq.com>
- Subject: Doesn't work, Why EXACTLY?
- Message-ID: <30FA8289.7AD6@bangate.compaq.com>
- Sender: news@twisto.eng.hou.compaq.com (System Administrator)
- Mime-Version: 1.0
- X-Mailer: Mozilla 2.0b2 (Windows; I; 32bit)
- Content-Type: text/plain; charset=us-ascii
- Organization: Compaq Computer Corporation
- Date: Mon, 15 Jan 1996 16:36:25 GMT
- X-Nntp-Posting-Host: 172.18.176.8
- Content-Transfer-Encoding: 7bit
-
- class X {
- };
- class Y : public X {
- };
-
- class Base {
- public:
- void func1(int a);
- void func2(X* x);
- };
-
- class Derived : public Base {
- public:
- void func1(float b);
- void func2(Y* y);
- };
-
- when I call func2 from a Derived object with a pointer
- to an X object, i get - "... cannot convert from X to Y...".
- So looks like compiler looks at method func2() in Derived
- class. I would think the signature of the call would make
- it look in Base class.
- On the lines of func1() i thought it would work.
- Please note that I don't want func2() to be virtual.
- I need func2() to do to distinct operations depending on
- what type of object was fed to it?
-
- Can anyone please explain FULLY?!?!?!
- thanks in advance
- saurabh
-
- --
- Saurabh Dixit
- "All opinions are always my own..."
- Compaq Computer Corporation
- --------------------------------------------------------------
- ----------
- Thou who sneezes without kerchief takes matters in own hands.
- - SomeoneIOnceNew
- --------------------------------------------------------------
- ----------
- xxxx
-